<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>切换大小写</title>
</head>
<script src="vue.js"></script>
<body>
    <div id="box">
      <input type="text"  @keydown.caps-lock="showInfo">
        <h2 v-if="change">{{msg}}</h2>
    
    </div>
    </body>
    <script>
        Vue.config.productionTip = false
        Vue.config.keyCodes.capslock = 20
      new Vue({
        el:'#box',
      data:{
          msg: '当前切换成大写模式',
          change:false
      },
      methods:{
            showInfo(){
                this.change = !this.change
            }
      }
      }
      )
    </script>
</html>